home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / prog_d / oleauttr.zip / XLOLE7.ZIP / MEMMISER.PAS next >
Pascal/Delphi Source File  |  1996-01-04  |  1KB  |  54 lines

  1. unit Memmiser;
  2. {
  3. // MEMMISER.PAS (C) 1995 W. Raike
  4. //              ALL RIGHTS RESERVED.
  5. }
  6. interface
  7. {*******************************************************************}
  8. {
  9.   Class TOLEObjectList is a list for keeping track of TOLEObjects.
  10.   This produces a (sort of) polymorphic TList.
  11. }
  12. {*******************************************************************}
  13.  
  14. uses
  15.   SysUtils, Classes, OLEAuto;
  16.  
  17. type
  18.  
  19.   { Use this as a template for a list of any kind of objects. }
  20.   TOLEObjectList = class(TList)
  21.   protected
  22.     { These methods hide the inherited (protected) ones of the same names. }
  23.     { Return/assign an object type instead of a pointer. }
  24.     function Get(i : Integer) : TOLEObject;
  25.     procedure Put(i : Integer; val : TOLEObject);
  26.   public
  27.     { Hide inherited property by declaring another with same name.}
  28.     { This one is the default property of TList, so is also the
  29.       default array property of this class. }
  30.     property Items[i : Integer] : TOLEObject read Get write Put;
  31.     destructor Destroy; override;
  32.   end;
  33.  
  34. implementation
  35.  
  36. function TOLEObjectList.Get(i : Integer) : TOLEObject;
  37. begin
  38.   Result := TOLEObject(inherited Items[i]);
  39. end;
  40.  
  41. procedure TOLEObjectList.Put(i : Integer ; val : TOLEObject);
  42. begin
  43.   inherited Put(i, val);
  44. end;
  45.  
  46. destructor TOLEObjectList.Destroy;
  47. begin
  48.   Clear;
  49.   inherited Destroy;
  50. end;
  51.  
  52. end.
  53.  
  54.